package lanQiao;

public class SuperFibonacci
{
	public static void main(String[] args)
	{
		int[] n = new int[18];
		
		n[8]=3131;
		n[5]=6415;
		n[3]=9973;
		n[13]=4659;
		n[7]=8907;
		n[15]=6545;
		n[4]=2091;
		n[10]=55;
		n[2]=1;
		n[1]=1;
		
		System.out.println(n[new java.util.Scanner(System.in).nextInt()%17]);
	}
}
